home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
graphics
/
avi2tga.zip
/
AVI2TGA.C
next >
Wrap
Text File
|
1994-02-22
|
2KB
|
58 lines
/* This source code and it's executable carry no warranty of any form.
You execute the code at your own risk and should ensure that you have
a backup of any disk that this may reside on.
The code was developed (#define developed hacked) for a particular
purpose and will only work for full frame 160*120*24 bit avi files.
*/
#include<stdio.h>
main(int argc,char **argv)
{
FILE *in,*out,*lst;
char tgaheader[]={0,0,0x2,0,0,0,0,0,0,0,0,0,0xa0,0,0x78,0,0x18,0};
char temp[59392];
char aviheader[2057];
char n[20],b[20],infile[20],outfile[20],lstfile[20];
int x,i,j,noframes;
printf("\aGraham's AVI (160*120*24bit full frame ONLY) to TGA convertor\n");
if (argc<4)
{
printf("Usage:-\n");
printf(" avi2tga in out #frames format\n");
printf(" eg avi2tga in test 150 %%02d\n");
printf(" will create 24 bit tga files called test01.tga to test150.tga\n");
printf(" and will create a file called out.lst containing a list of the\n");
printf(" files created suitable for feeding to CMPEG\n");
printf("\nGraham Logan Febuary 1994\n");
printf("graham@taurus.dct.ac.uk\n");
exit();
}
noframes=atoi(argv[3]);
strcpy(infile,argv[1]);
strcat(infile,".avi");
in=fopen(infile,"rb");
fread(aviheader,sizeof(char),2056,in);
strcpy(lstfile,argv[2]);
strcat(lstfile,".lst");
lst=fopen(lstfile,"w");
for (x=1;x<=noframes;x++)
{
strcpy(outfile,argv[2]);
sprintf(b,argv[4],x);
strcat(outfile,b);
strcat(outfile,".tga");
printf("%s frame %d -> %s\n",infile,x,outfile);
fprintf(lst,"%s\n",outfile);
out=fopen(outfile,"wb");
fwrite(tgaheader,sizeof(char),18,out);
fread(temp,sizeof(char),59392,in);
fwrite(temp,sizeof(char),57600,out);
fclose(out);
}
}